'''
Created on Mar 8, 2016

@author: grind
'''

a = [66.25, 333, 333, 1, 1234.5]
print("list=", a)
print("count=", a.count(333), a.count(66.25), a.count('x'))
a.insert(2, -1)
a.append(333)
print("after change, list=", a)

cursor = a.index(333)
print("333 index = ", cursor)

a.remove(333)
print("after remove, list=", a)

a.reverse()
print("list=", a)
a.sort()
print("list=", a)

print("a.pop", a.pop())
print("list=", a)

print("-" * 50)

"链表当队列使用"
"============================================"
from collections import deque

queue = deque(["Eric", "John", "Michael"])
print("queue=", queue)
queue.append("Terry")           # Terry arrives
print("queue=", queue)
queue.append("Graham")          # Graham arrives
print("queue=", queue)
queue.popleft()
print("queue=", queue)
print("-" * 50)

"列表推导式"
"============================================"
squares = []

for x in range(10):
    squares.append(x**2)
print("squares=", squares)



